/*
 * StoryConfig.cpp
 *
 *  Created on: 2015-9-24
 *      Author: 10095427
 */

#include "StoryConfig.h"

#define    STORY_SAVE_KEY   "StorySaveKey%d"

static StoryConfig *s_SharedStoryConfig = nullptr;

StoryConfig* StoryConfig::getInstance()
{
    if (!s_SharedStoryConfig)
    {
    	s_SharedStoryConfig = new (std::nothrow) StoryConfig();
        CCASSERT(s_SharedStoryConfig, "FATAL: Not enough memory");
        s_SharedStoryConfig->init();
    }

    return s_SharedStoryConfig;
}

bool StoryConfig::init(void)
{
    return true;
}

StoryConfig::StoryConfig() {

}

StoryConfig::~StoryConfig() {
	s_SharedStoryConfig = nullptr;
}

bool StoryConfig::isStoryShowed(int type)
{
	return UserDefault::getInstance()->getIntegerForKey(
			__String::createWithFormat(STORY_SAVE_KEY,type)->getCString(),0);
}
void StoryConfig::storyShowedSave(int type)
{
	UserDefault::getInstance()->setIntegerForKey(
			__String::createWithFormat(STORY_SAVE_KEY,type)->getCString(),1);
}

